package model;

public class CalculateNextLeadStateStrategy implements CalculateNextStateStrategy{
	
	public SMSObjectState getNextState(SMSObject smsObject, RuleSelector ruleSelector) {
		boolean status = ruleSelector.processRuleRequest();
		System.out.println("Rule: "+ ruleSelector.getRule().getRuleDescripton());
		SMSObjectState currentState = smsObject.getCurrentState();
		
		 if (status == true) {
			
			
			if (currentState instanceof Raw) {
				return new Imported();
			} else if (currentState instanceof Imported) {
				return new Assigned();
				
			}
			else if (currentState instanceof Assigned) {
				return new Merged();
				
			} else if (currentState instanceof Merged) {
				return new Prepared();
			} else if (currentState instanceof Prepared) {
				return new Qualified();
			}
		}else{
			 if (currentState instanceof Prepared) 
				return new Merged();
		}
		
		return smsObject.getCurrentState();
	}
	
}
